package gui.JList;

import javax.swing.JFrame;
import javax.swing.*;

public class Aufgabe_JList extends JPanel {


	
	public Aufgabe_JList(){
		
		
		DefaultListModel lm = new DefaultListModel();
		for(String inh: new String[]{"Das", "ist", "das", "Haus", "vom"}){
			lm.addElement(inh);			
		}
		
		JList liste = new JList(lm);
		
		liste.setVisibleRowCount(4);
		JScrollPane scroll = new JScrollPane(liste);
		scroll.setSize(200, 100);
		
		this.add(scroll);
		
		
	}
	
	
	public static void main(String[] args) {
		
		
		JFrame frame = new JFrame("JList");
		    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		    frame.setContentPane(new Aufgabe_JList());
		    frame.setSize(560, 200);
		    frame.setVisible(true);

		
	}

}
